<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 
<%
String path = request.getContextPath();  
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 thansitional//EN" "http://www.w3.org/th/html4/loose.dtd">
<html>
<head>
	<base href="<%=basePath%>">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>设备管理首页</title>
</head>

<body>
	<div style="width:80%;margin:50px auto;">
		<div style="margin-left:5px;"><a href="device/adddevice.jsp">添加设备</a></div>
		<table style="width:100%;" border="1px" cellspacing="0">
			<caption style="font-size:16px; font-weight:bold; margin-bottom:10px;">设备管理</caption>
			<thead>
				<tr>
					<th></th>
					<th>设备编号</th>
					<th>设备地址</th>
					<th>设备型号</th>
					<th>额定功率</th>
					<th>额定电压</th>
					<th>额定电流</th>
					<th>生产日期</th>
					<th>设备状态</th>
				</tr>
			</thead>
			<tbody>				
				<c:if test="${list == null}">
				<tr>
	                <td colspan="12"><p style="text-align:center;">没有机器设备！！！</p></td>
	            </tr>
				</c:if>
				<c:if test="${list != null}">
				<%  int num = (Integer)request.getAttribute("currPage");
	    			int i= (num-1)*10; %>
				<c:forEach items="${list}" var="item"> 
				<tr> 
					<% i++; %>
	    			<td><%= i %></td>
					<td>${item.name}</td>
					<td>${item.number}</td>
					<td>${item.model}</td>
					<td>${item.power}</td>
					<td>${item.voltage}</td>
					<td>${item.current}</td>
					<td>${item.devicedate}</td>
					<td>${item.status}</td>
				</tr>
				</c:forEach>
				</c:if>
			</tbody>
			<tfoot>
	            <tr>
	                <td colspan="11">
	    			<a href="device/getDevice.action?currPage=1">第一页</a>
	    			<a href="device/getDevice.action?currPage=${currPage-1}">上一页</a>
	    			<a href="device/getDevice.action?currPage=${currPage+1}">下一页</a>
	    			<a href="device/getDevice.action?currPage=${totalPage}">最末页</a>
	    			${currPage}/${totalPage}页,共${totalRows}个项目
	    			</td>
	            </tr>
	        </tfoot>
		</table>
	</div>
</body>
</html>